package com.example.acroandroiduser;

import android.content.Context;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class ChatEditText extends EditText {

	TextView tv1;
	TextView tv2;
	EditText et;
	Button b1;

	public ChatEditText(Context context) {
		super(context);
		init();
	}

	public ChatEditText(Context context, AttributeSet attrs) {
		super(context, attrs);
		init();
	}

	public ChatEditText(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		init();
	}

	private void init() {

	}

	public void setItems(TextView tv1, TextView tv2, Button b1, EditText et) {
		this.tv1 = tv1;
		this.b1 = b1;
		this.tv2 = tv2;
		this.et = et;
	}

	public boolean onKeyPreIme(int keyCode, KeyEvent event) {
		if (keyCode == KeyEvent.KEYCODE_BACK
				&& event.getAction() == KeyEvent.ACTION_UP) {
			tv1.setVisibility(View.VISIBLE);
			tv1.setEnabled(true);
			b1.setVisibility(View.VISIBLE);
			b1.setEnabled(true);
			et.setVisibility(View.VISIBLE);
			et.setEnabled(true);
			tv2.setVisibility(View.VISIBLE);
			tv2.setEnabled(true);
			return false;
		}
		return super.dispatchKeyEvent(event);
	}
}
